#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

void Print(int x)
{
	for (int i = 31; i >= 0; i -= 2)
	{
		printf("%d ", (x >> i) & 1);
	}
	printf("\n");
	for (int i = 30; i >= 0; i -= 2)
	{
		printf("%d ", (x >> i) & 1);
	}
	printf("\n");
}
int main()
{
	int a = 0;
	scanf("%d", &a);
	Print(a);
	return 0;
}